#!/bin/env bash
file="/root/guoqiang/datalist"

# 检查文件是否存在
function check_files {
  if [ -f "$file" ]; then
    echo "$file exists."
  else
    echo "$file done not exists."
  fi
}

# 重启服务
function restart_service {
    # shellcheck disable=SC2002
    # shellcheck disable=SC2162
    cat "$file" | while read server
    do
      kubectl delete pod -n default "$server"
    done
}

check_files
restart_service